<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList, com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.chiptrack.users.Functionality" %>
<%@ page import="com.scalar.chiptrack.users.User" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/costCodeMaster.do"/>


<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>

<%
    String closeWindowAfterSave = ( String ) request.getAttribute( "closeWindowAfterSave" );
%>
<html:html locale="true">

<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel=stylesheet>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>

<script language='javascript'>

<% if ( closeWindowAfterSave != null && closeWindowAfterSave.equalsIgnoreCase( "true" ) ) { %>
    window.close();
<% } %>

function save()
{
    var form  = document.costCodeMasterForm;
    form.action = '<%=chipTracContext%>/costCodeMaster.do?action=save';
    form.submit();
}

function reset()
{
    document.costCodeMasterForm.reset();
}

function closeWindow( form ) 
{
 	window.close();
}

</script>

</HEAD>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" >
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TR>
	    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@include file="/jsp/finance/finance_menu.jsp" %>
            <!-- end of the side navigations -->
        </TD>
	    <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
	    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
	    <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
	        <BR>
            <html:form name="costCodeMasterForm" type="com.scalar.chiptrack.finance.costCode.forms.CostCodeMasterForm" action="/costCodeMaster.do">
            <table border="0" width="90%" align="center">
                <tr>
                    <td align="center" class="NArialW">Cost Code Master</td>
                </tr>
                <tr>
                    <td width="100%">
                        <table border="0" width="100%" cellspacing='0' cellpadding='0' align='left'>
                            <tr><td><chiptrack:info styleClass='NArialL' />&nbsp;</td></tr>
                            <tr><td><chiptrack:errors styleClass='NArialL' />&nbsp;</td></tr>
                            <tr><td align="left" class='NArialL'><FONT id="errors" styleClass="NArialL" color='FF0000'>&nbsp;</font></td></tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <bean:size id="waferCodeCodeListSize" name="costCodeMasterForm" property="waferCodeCodeList"/>
                        <table border="0" width="50%" align="center">
                            <tr>
                                <td width="100%" colspan="2" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Base Wafer Cost Code</font></font></td>
                            </tr>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Wafer Part No</font></font></td>
                                <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Cost Code</font></font></td>
                            </tr>
                            <logic:greaterThan name="waferCodeCodeListSize" value="0">
                            <nested:iterate id="costCodeMaster" name="costCodeMasterForm" property="waferCodeCodeList" type="com.scalar.chiptrack.finance.costCode.CostCodeMaster" indexId="iteratorIdx">
                            <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> >
                                <td nowrap align="center" class="NArialL">
                                    <nested:write property="waferPartNumber" />
                                    <nested:hidden property="waferPartNumber" />
                                    <nested:hidden property="autoId" />
                                </td>
                                <td nowrap align="center" class="NArialL">
                                    <nested:text property="costCode" styleClass = "valuetxfield"/>
                                </td>
                            </tr>
                            </nested:iterate>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                            </logic:greaterThan>
                            <logic:equal name="waferCodeCodeListSize" value="0">
                            <tr>
                                <td colspan="2" align="center" bgcolor="#FFFFEE">
                                    <font class="NArialL"><< Records not found >></font>
                                </td>
                            </tr>
                            </logic:equal>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <bean:size id="packageCodeCodeListSize" name="costCodeMasterForm" property="packageCodeCodeList"/>
                        <table border="0" width="50%" align="center">
                            <tr>
                                <td width="100%" colspan="2" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Package Cost Code</font></font></td>
                            </tr>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Package Type</font></font></td>
                                <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Cost Code</font></font></td>
                            </tr>
                            <logic:greaterThan name="packageCodeCodeListSize" value="0">
                            <nested:iterate id="costCodeMaster" name="costCodeMasterForm" property="packageCodeCodeList" type="com.scalar.chiptrack.finance.costCode.CostCodeMaster" indexId="iteratorIdx">
                            <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> >
                                <td nowrap align="center" class="NArialL">
                                    <nested:write property="packageType" />
                                    <nested:hidden property="packageType" />
                                    <nested:hidden property="autoId" />
                                </td>
                                <td nowrap align="center" class="NArialL">
                                    <nested:text property="costCode" styleClass = "valuetxfield"/>
                                </td>
                            </tr>
                            </nested:iterate>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                            </logic:greaterThan>
                            <logic:equal name="packageCodeCodeListSize" value="0">
                            <tr>
                                <td colspan="2" align="center" bgcolor="#FFFFEE">
                                    <font class="NArialL"><< Records not found >></font>
                                </td>
                            </tr>
                            </logic:equal>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <bean:size id="pinCostCodeListSize" name="costCodeMasterForm" property="pinCostCodeList"/>
                        <table border="0" width="50%" align="center">
                            <tr>
                                <td width="100%" colspan="2" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Pin Count Code</font></font></td>
                            </tr>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Pin Count</font></font></td>
                                <td width="50%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Cost Code</font></font></td>
                            </tr>
                            <logic:greaterThan name="pinCostCodeListSize" value="0">
                            <nested:iterate id="costCodeMaster" name="costCodeMasterForm" property="pinCostCodeList" type="com.scalar.chiptrack.finance.costCode.CostCodeMaster" indexId="iteratorIdx">
                            <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> >
                                <td nowrap align="center" class="NArialL">
                                    <nested:write property="pinCount" />
                                    <nested:hidden property="pinCount" />
                                    <nested:hidden property="autoId" />
                                </td>
                                <td nowrap align="center" class="NArialL">
                                    <nested:text property="costCode" styleClass = "valuetxfield"/>
                                </td>
                            </tr>
                            </nested:iterate>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                            </logic:greaterThan>
                            <logic:equal name="pinCostCodeListSize" value="0">
                            <tr>
                                <td colspan="2" align="center" bgcolor="#FFFFEE">
                                    <font class="NArialL"><< Records not found >></font>
                                </td>
                            </tr>
                            </logic:equal>
                            <tr><td colspan="2"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                            <tr>
                                <td colspan="2" align=center>
                                    <chiptrack:restrictedLink functionality='<%=Functionality.COST_CODES_MASTER %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:save();' onmouseover="window.status='Click to  Cost Codes';return true" onmouseout="window.status='';return true">
                                        <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" title="Click here to Cost Codes"/>
                                    </chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="javascript:reset()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
                                </td>
                            </tr>                            
                        </table>
                    </td>
                </tr>
            </table>
            </html:form>
        </td>
    </tr>
</table>
</body>
</html:html>
